//
//  DXEmtionButton.swift
//  weiBoOfSwift
//
//  Created by simon on 15/12/17.
//  Copyright © 2015年 simon. All rights reserved.
//

import UIKit

class DXEmtionButton: UIButton {

    var emotionModel:DXEmotonModel?{
        didSet{

            if !emotionModel!.isEmoji{
          let imgemotion =   UIImage(named: emotionModel!.img!, inBundle: DXEmotionViewModel.sharedEmoton.EmotionBundel, compatibleWithTraitCollection: nil)
                setImage(imgemotion, forState:.Normal)
//                setImage(UIImage(named: emotionModel!.img!), forState:.Normal)
               setTitle(nil, forState: UIControlState.Normal)
                
            }else {
               setImage(nil, forState:.Normal)
                
            setTitle(emotionModel!.code!.emoji(), forState: UIControlState.Normal)
            }
        
        }
    }

}
